class move{
	constructor(){
		this.odiv=document.getElementsByTagName("div")[0];
		this.ka=document.getElementsByTagName("p")[0];
		this.go();
	}
	go(){
		var _this=this;
		_this.odiv.onmousedown=function(ev){
			console.log(_this.ka)
			_this.ka.className="k";
			ev=ev||event;
			_this.disX=ev.clientX-_this.odiv.offsetLeft;
			_this.disY=ev.clientY-_this.odiv.offsetTop;
			document.onmousemove=function(ev){
				_this.movea();
			}
			document.onmouseup=function(ev){
				_this.ka.className='';
				_this.movea2();
				document.onmousemove=null;
			}
		}
	}
	movea(ev){
		console.log(this)
		ev=ev||event;
		var x=ev.clientX-this.disX;
		var y=ev.clientY-this.disY;
		this.ka.style.left=x+'px';
		this.ka.style.top=y+'px';
	}
	movea2(ev){
		console.log(this)
		ev=ev||event;
		var x=ev.clientX-this.disX;
		var y=ev.clientY-this.disY;
		this.odiv.style.left=x+'px';
		this.odiv.style.top=y+'px';
	}
}
new move();